<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>document</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/style.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/time.js"></script>
</head>
<body>
	<div class="container">
	<%@ include file="include/top.jsp" %>
	<!--header end-->
		<div class="content">
			<div class="row">
				<div class="span9">
					<div class="document">
						<ul>
							<li><a href=""><i class="icon-folder-open"></i>资料</a></li>
							<li class="pull-right"><a href="adddocument.jspx"><i class="icon-plus"></i>分享新资料</a></li>
						</ul>
					</div>
					<div class="wall">
						<c:if test="${not empty sessionScope.error }">
							<div class="alert alert-error" style="color:red;margin-left:15px">
							  <button type="button" class="close" data-dismiss="alert">×</button>
							  <strong>${sessionScope.error }</strong>
							  <c:remove var="error" scope="session"/>
							</div>
						</c:if>
						<c:forEach items="${requestScope.page.list }" var="document">
							<blockquote>
							  <h5><a href="documentshow.jspx?id=${document.id}">${document.title }</a></h5>
							  <p style="font-size:14px;line-height:1.5;">${document.content }</p>
							  <small title="${document.createtime }" id="${document.id }"></small>
							  <script type="text/javascript">
							  	var endtime = getNow();
							  	var starttime = '${document.createtime }';
							  	var diftime = getTimeDif(starttime,endtime);
							  	var id = '${document.id}';
							  	var name = '${document.employee.name }';
							  	$("#"+id).text(name+diftime);
							  </script>
							  <c:if test="${document.employee_id == sessionScope.employee.id }">
								  <a href="documentedit.jspx?id=${document.id }"><i class="icon-pencil"></i></a>
								  <a href="deldocument.jspx?id=${document.id }" class="icon-trash"></a>
							  </c:if>
							</blockquote>
						</c:forEach>
						<c:if test="${page.totalPage > 1}">
							<div class="pagination pagination-centered">
							  <ul>
									<c:choose>
										<c:when test="${page.pageNum == 1}">
											<li><a>首页</a></li>
											<li><a>上一页</a></li>
										</c:when>
										<c:otherwise>
											<li><a href="documentlist.jspx?p=1">首页</a></li>
											<li><a href="documentlist.jspx?p=${page.pageNum-1}">上一页</a></li>
										</c:otherwise>
									</c:choose>
									<c:choose>
										<c:when test="${page.pageNum == page.totalPage}">
											<li><a>下一页</a></li>
									  		<li><a>尾页</a></li>
										</c:when>
										<c:otherwise>
											<li><a href="documentlist.jspx?p=${page.pageNum+1}">下一页</a></li>
									  		<li><a href="documentlist.jspx?p=${page.totalPage}">尾页</a></li>
										</c:otherwise>
									</c:choose>
								</ul>
							</div>
						</c:if>
					</div>
				</div>
				<div class="span3">
				</div>
			</div>
		</div>
		<!--container end-->
		<div class="footer">
			<p>Copyright © 2013 xxx版权所有</p>
		</div>
		<!--footer end-->
	</div>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function(){
			
		});
	</script>
</body>
</html>